package com.hxx.day5;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class TestDemo4 {
    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("1001","张三1");
        map.put("1002","张三2");
        map.put("1003","张三3");

        System.out.println(map.get("1001"));
        //普通循环
        /*Set set = map.entrySet();
        for (Object o : set) {
            Map.Entry entry = (Map.Entry) o;
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }*/
        /*System.out.println("-----获取entry，获取key和value-------");
        Set set = map.keySet();
        for (Object key : set) {
            System.out.println(key );
        }*/
        System.out.println("-----获取entry，获取key和value-------");
        Collection values = map.values();
        for (Object value : values) {
            System.out.println(value);
        }
    }
}
